package ru.spb.osll.myfit.client.widget.filter;


import com.google.gwt.user.client.ui.TextBox;

import ru.spb.osll.myfit.common.filter.MatchFilter;
import ru.spb.osll.myfit.common.filter.PageResultFilter;


/**
 * User: Alexander Opeykin
 * Date: 3/26/12
 */


/**
 * Initialize filter that requires only one string with text from TextBox.
 */
public class TextBoxFilterInitializer implements FilterInitializer {
  TextBox m_textBox;
  MatchFilter m_filter;

  public TextBoxFilterInitializer(TextBox textBox, MatchFilter filter) {
    this.m_textBox = textBox;
    this.m_filter = filter;
  }

  @Override
  public PageResultFilter getInitializedFilter() {
    m_filter.setValue(m_textBox.getValue());
    return m_filter;
  }
}
